FROM docker.io/library/python:3.12-slim

# 安装系统依赖（关键）
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    default-libmysqlclient-dev \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

#如果是 Django 应用，可能需要收集静态文件
#RUN python manage.py collectstatic --noinput

EXPOSE 8000

# 对于 Flask
# CMD ["gunicorn", "--bind", "0.0.0.0:8000", "app:app"]

# 对于 Django
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "myproject.wsgi:application"]
